

<!--
 * @Description: 直接荧光屏
 *
 * Copyright (c) 2023 by cgl/微盛信息产业有限公司, All Rights Reserved.
-->
<template>
  <div class="content">
    <div id="table-1">
      <div class="innertitle">1.本底值检测:</div>
      <div class="tip-30">
        <el-radio v-model="form1.backgroundFormula" :label="1" data-must="1"
          >不扣除本底处理公式：</el-radio
        ><i>$D = K · \overline m$</i>
        <el-radio
          style="margin-left: 50px"
          v-model="form1.backgroundFormula"
          :label="2"
          data-must="1"
          >扣除本底处理公式：</el-radio
        ><i>$D = K · (M_{max} - C_{min})$</i>
      </div>

      <table
        border="1"
        cellspacing="0"
        cellpadding="0"
        align="center"
        style="width: 100%"
      >
        <tr>
          <td colspan="5">
            检测条件
            <!-- （<el-radio v-model="form1.exposureType" :label="1">手动</el-radio>
            <el-radio v-model="form1.exposureType" :label="2">自动</el-radio>） -->
            （<el-radio v-model="form1.protectionType" :label="0">加速器治疗</el-radio>
            <el-radio v-model="form1.protectionType" :label="1">含放射源治疗</el-radio>）
          </td>
          <td colspan="9">检测用散射模体</td>
        </tr>
        <tr>
          <td colspan="5">
            <template v-if="form1.protectionType == 0 || !form1.protectionType">
              剂量率(Gy/min)：<el-input v-model="form1.doseRate" class="input-line" />；
              能量(MV)：<el-input v-model="form1.energy" class="input-line" />；
              照射野(cm)：<el-input v-model="form1.irradiationFieldLength" class="input-line" /> × <el-input v-model="form1.irradiationFieldWidth" class="input-line" />
            </template>
            <template v-if="form1.protectionType == 1">
              裸源照射状态；
            </template>
            <!-- <el-input v-model="form1.tubeVoltage" class="input-line" />KV
            <el-input v-model="form1.tubeCurrent" class="input-line" />
            <el-radio-group v-model="form1.tubeCurrentUnit" class="split-radio">
              <el-radio :label="0">mA</el-radio>
              <span class="split">/</span>
              <el-radio :label="1">mAs</el-radio>
            </el-radio-group>
            <el-input v-model="form1.presets" data-cusValidate="text" class="input-line" />s
            <div style="margin-top: 0px;" v-if="basicForm.basicInfo.isHeader || (basicForm.protectionDetectionVo && basicForm.protectionDetectionVo.basicInfo.isHeader)">
              头颅侧位方向:
              <el-select class="dir-select" style="width: 100px;" v-model="form1.headLateralDirection">
                <el-option label="东" value="东"></el-option>
                <el-option label="南" value="南"></el-option>
                <el-option label="西" value="西"></el-option>
                <el-option label="北" value="北"></el-option>
                <el-option label="东南" value="东南"></el-option>
                <el-option label="西南" value="西南"></el-option>
                <el-option label="东北" value="东北"></el-option>
                <el-option label="西北" value="西北"></el-option>
              </el-select>；
              校准因子：
              <el-input v-model="form1.headLateralCalibrationFactor" class="input-line result" disabled />
              <div>
                头颅侧位检测条件:
                <el-input v-model="form1.headLateralTubeVoltage" class="input-line" />KV
                <el-input v-model="form1.headLateralTubeCurrent" class="input-line" />
                <el-radio-group v-model="form1.headLateralTubeCurrentUnit" class="split-radio">
                  <el-radio :label="0">mA</el-radio>
                  <span class="split">/</span>
                  <el-radio :label="1">mAs</el-radio>
                </el-radio-group>
                <el-input v-model="form1.headLateralPresets" data-cusValidate="text" class="input-line" />s
              </div>
            </div> -->
          </td>
          <td colspan="9">
            <el-checkbox v-model="form1.standardModel">标准水模</el-checkbox>
            <el-checkbox v-model="form1.standardModelAnd_1_5mm"
              >标准水模+1.5mm铜板</el-checkbox
            >
            <el-checkbox v-model="form1.scatteredWaterTank">散射水箱</el-checkbox>
            <el-checkbox v-model="form1.ctHeadModel">CT头模</el-checkbox>
            <el-checkbox v-model="form1.ctBodyModel">CT体模</el-checkbox>
            <el-checkbox v-model="form1.pmma_6cm">6cm PMMA</el-checkbox>
          </td>
        </tr>
      </table>
      <table
        border="1"
        cellspacing="0"
        cellpadding="0"
        align="center"
        style="width: 100%"
      >
        <tr>
          <td colspan="10">
            本底测量值C<br />
            <el-radio-group v-model="form1.backgroundValueUnit" class="split-radio">
              <el-radio :label="1">nSv/h</el-radio>
              <el-radio :label="2">μSv/h</el-radio>
              <el-radio :label="3">mSv/h</el-radio>
            </el-radio-group>
          </td>
          <td style="width: 100px">本底校准因子</td>
          <td style="width: 100px">
            修正后本底平均值B,μSv/h
          </td>
          <td style="width: 100px">
            修正后本底范围,μSv/h
          </td>
          <td>校准因子K</td>
          <td style="width: 60px;">MDL</td>
        </tr>
        <tr>
          <td><el-input v-model="form1.background_1" /></td>
          <td><el-input v-model="form1.background_2" /></td>
          <td><el-input v-model="form1.background_3" /></td>
          <td><el-input v-model="form1.background_4" /></td>
          <td><el-input v-model="form1.background_5" /></td>
          <td><el-input v-model="form1.background_6" /></td>
          <td><el-input v-model="form1.background_7" /></td>
          <td><el-input v-model="form1.background_8" /></td>
          <td><el-input v-model="form1.background_9" /></td>
          <td><el-input v-model="form1.background_10" /></td>
          <td class="result">
            <el-input v-model="form1.backgroundCalibrationFactor" disabled />
          </td>
          <td class="result">
            <el-input v-model="form1.backgroundCountAverage" disabled />
          </td>
          <td class="result">
            <el-input v-model="form1.backgroundCountRadius" disabled />
          </td>
          <td class="result">
            <el-input v-model="form1.calibrationFactor" disabled />
          </td>
          <td>
            <el-input v-model="form1.mdl" />
          </td>
        </tr>
      </table>
    </div>

    <div id="table-4">
      <div class="innertitle">2.周剂量限值导出剂量率控制水平:</div>
      <table
        border="1"
        cellspacing="0"
        cellpadding="0"
        align="center"
        style="width: 100%"
      >
        <tr>
          <td rowspan="2" style="width: 50px">序号</td>
          <td rowspan="2" style="width: 220px">场所名称</td>
          <td rowspan="2" style="width: 180px">使用因子<br/>(U)</td>
          <td rowspan="2" style="width: 180px">居留因子<br/>(T)</td>
          <td rowspan="2" style="width: 180px">周工作负荷<br/>t·(h)</td>
          <td colspan="2">周剂量限值导出剂量率控制水平</td>
          <td style="width: 120px">参考控制水平</td>
        </tr>
        <tr>
          <td><i>$H_eμSv/w$</i></td>
          <td><i>$H_cμSv/h$</i></td>
          <td><i>$H_{c,max}μSv/h$</i></td>
        </tr>
        <tr v-for="(item, index) in form4.detectionPlaceList">
          <td>
            <el-input v-model="item.serial" />
          </td>
          <td>
            <el-input data-cusValidate="text" v-model="item['positionName']" />
          </td>
          <td>
            <el-input v-model="item['useFactor']" />
          </td>
          <td>
            <el-input v-model="item['occupancyFactor']" />
          </td>
          <td>
            <el-input v-model="item['weeklyWorkload']" />
          </td>
          <td>
            <el-radio-group v-model="item['unit']">
              <el-radio :label="1">100</el-radio>
              <el-radio :label="2">5</el-radio>
            </el-radio-group>
          </td>
          <td>
            <el-input v-model="item['doseRateValue']" />
          </td>
          <td>
            <el-input v-model="item['referenceValue']" />
          </td>
        </tr>
      </table>
    </div>

    <div id="table-2">
      <div class="innertitle">3.周围工作场所辐射防护检测:</div>
      <table
        border="1"
        cellspacing="0"
        cellpadding="0"
        align="center"
        style="width: 100%"
      >
        <tr>
          <td rowspan="2" style="width: 50px">序号</td>
          <td rowspan="2" style="width: 220px">关注点</td>
          <td colspan="6">周围剂量当量率</td>
          <td rowspan="2" v-if="basicForm.qualityControlCodes && basicForm.qualityControlCodes.includes('06')">年剂量<br/>（mSv/a）</td>
          <td rowspan="2" style="width: 180px">备注</td>
        </tr>
        <tr>
          <td colspan="3">读出值M</td>
          <td style="width: 220px;">单位</td>
          <td>平均值<i>$\overline M$</i></td>
          <td>修正值D<br/>(μSv/h)</td>
        </tr>
        <tr v-for="index in 23" :key="index">
          <td><el-input v-model="form2['serial_' + index]" disabled /></td>
          <td>
            <el-input data-cusValidate="text" v-model="form2['positionName_' + index]" />
          </td>
          <td><el-input v-model="form2[`readoutValue_${index}_1`]" /></td>
          <td><el-input v-model="form2[`readoutValue_${index}_2`]" /></td>
          <td><el-input v-model="form2[`readoutValue_${index}_3`]" /></td>
          <td>
            <el-radio-group v-model="form2['readoutValueUnit_' + index]" class="split-radio">
              <el-radio :label="1">nSv/h</el-radio>
              <el-radio :label="2">μSv/h</el-radio>
              <el-radio :label="3">mSv/h</el-radio>
            </el-radio-group>
          </td>
          <td class="result">
            <el-input v-model="form2['correctedAverage_' + index]" disabled />
          </td>
          <td class="result">
            <el-input v-model="form2['correctedValue_' + index]" disabled />
          </td>
          <td class="result" v-if="basicForm.qualityControlCodes && basicForm.qualityControlCodes.includes('06')">
            <el-input
              data-cusValidate="text"
              v-model="form2['yearDoseValue_' + index]"
              disabled
            />
          </td>
          <td>
            <el-autocomplete
              data-cusValidate="text"
              v-model="form2['orientation_' + index]"
              :fetch-suggestions="(queryString, cb) => {
                cb([
                  { value: '土层,人员无法到达' },
                  { value: '临空,人员无法到达' },
                  { value: '无建筑,人员无法到达' },
                ])
              }"
              @select="submitTestForm(2)"
              placeholder=""
              :popper-append-to-body="false"
            ></el-autocomplete>
            <!-- <el-input data-cusValidate="text" v-model="form2['orientation_' + index]" /> -->
          </td>
        </tr>
        <tr>
          <td><el-input v-model="form2.serial_24" disabled /></td>
          <td>
            <el-input
              data-cusValidate="text"
              v-model="form2.positionName_24"
            /><br />
            <!-- (<el-input
              data-cusValidate="text"
              v-model="form2.positionNameExpand_24"
              class="input-line"
            />) -->
          </td>
          <td><el-input v-model="form2.readoutValue_24_1" /></td>
          <td><el-input v-model="form2.readoutValue_24_2" /></td>
          <td><el-input v-model="form2.readoutValue_24_3" /></td>
          <td>
            <el-radio-group v-model="form2.readoutValueUnit_24" class="split-radio">
              <el-radio :label="1">nSv/h</el-radio>
              <el-radio :label="2">μSv/h</el-radio>
              <el-radio :label="3">mSv/h</el-radio>
            </el-radio-group>
          </td>
          <td class="result">
            <el-input v-model="form2.correctedAverage_24" disabled />
          </td>
          <td class="result">
            <el-input v-model="form2.correctedValue_24" disabled />
          </td>
          <td class="result" v-if="basicForm.qualityControlCodes && basicForm.qualityControlCodes.includes('06')">
            <el-input
              data-cusValidate="text"
              v-model="form2.yearDoseValue_24"
              disabled
            />
          </td>
          <td>
            <el-autocomplete
              data-cusValidate="text"
              v-model="form2.orientation_24"
              :fetch-suggestions="(queryString, cb) => {
                cb([
                  { value: '土层,人员无法到达' },
                  { value: '临空,人员无法到达' },
                  { value: '无建筑,人员无法到达' },
                ])
              }"
              @select="submitTestForm(2)"
              placeholder=""
              :popper-append-to-body="false"
            ></el-autocomplete>
            <!-- <el-input data-cusValidate="text" v-model="form2.orientation_24" /> -->
          </td>
        </tr>
        <tr>
          <td><el-input v-model="form2.serial_25" disabled /></td>
          <td>
            <el-input
              data-cusValidate="text"
              v-model="form2.positionName_25"
            /><br />
            <!-- (<el-input
              data-cusValidate="text"
              v-model="form2.positionNameExpand_25"
              class="input-line"
            />) -->
          </td>
          <td><el-input v-model="form2.readoutValue_25_1" /></td>
          <td><el-input v-model="form2.readoutValue_25_2" /></td>
          <td><el-input v-model="form2.readoutValue_25_3" /></td>
          <td>
            <el-radio-group v-model="form2.readoutValueUnit_25" class="split-radio">
              <el-radio :label="1">nSv/h</el-radio>
              <el-radio :label="2">μSv/h</el-radio>
              <el-radio :label="3">mSv/h</el-radio>
            </el-radio-group>
          </td>
          <td class="result">
            <el-input v-model="form2.correctedAverage_25" disabled />
          </td>
          <td class="result">
            <el-input v-model="form2.correctedValue_25" disabled />
          </td>
          <td class="result" v-if="basicForm.qualityControlCodes && basicForm.qualityControlCodes.includes('06')">
            <el-input
              data-cusValidate="text"
              v-model="form2.yearDoseValue_25"
              disabled
            />
          </td>
          <td>
            <el-autocomplete
              data-cusValidate="text"
              v-model="form2.orientation_25"
              :fetch-suggestions="(queryString, cb) => {
                cb([
                  { value: '土层,人员无法到达' },
                  { value: '临空,人员无法到达' },
                  { value: '无建筑,人员无法到达' },
                ])
              }"
              @select="submitTestForm(2)"
              placeholder=""
              :popper-append-to-body="false"
            ></el-autocomplete>
            <!-- <el-input data-cusValidate="text" v-model="form2.orientation_25" /> -->
          </td>
        </tr>
        <tr>
          <td><el-input v-model="form2.serial_26" disabled /></td>
          <td>
            <el-input
              data-cusValidate="text"
              v-model="form2.positionName_26"
            /><br />
            <!-- (<el-input
              data-cusValidate="text"
              v-model="form2.positionNameExpand_26"
              class="input-line"
            />) -->
          </td>
          <td><el-input v-model="form2.readoutValue_26_1" /></td>
          <td><el-input v-model="form2.readoutValue_26_2" /></td>
          <td><el-input v-model="form2.readoutValue_26_3" /></td>
          <td>
            <el-radio-group v-model="form2.readoutValueUnit_26" class="split-radio">
              <el-radio :label="1">nSv/h</el-radio>
              <el-radio :label="2">μSv/h</el-radio>
              <el-radio :label="3">mSv/h</el-radio>
            </el-radio-group>
          </td>
          <td class="result">
            <el-input v-model="form2.correctedAverage_26" disabled />
          </td>
          <td class="result">
            <el-input v-model="form2.correctedValue_26" disabled />
          </td>
          <td class="result" v-if="basicForm.qualityControlCodes && basicForm.qualityControlCodes.includes('06')">
            <el-input
              data-cusValidate="text"
              v-model="form2.yearDoseValue_26"
              disabled
            />
          </td>
          <td>
            <el-autocomplete
              data-cusValidate="text"
              v-model="form2.orientation_26"
              :fetch-suggestions="(queryString, cb) => {
                cb([
                  { value: '土层,人员无法到达' },
                  { value: '临空,人员无法到达' },
                  { value: '无建筑,人员无法到达' },
                ])
              }"
              @select="submitTestForm(2)"
              placeholder=""
              :popper-append-to-body="false"
            ></el-autocomplete>
            <!-- <el-input data-cusValidate="text" v-model="form2.orientation_26" /> -->
          </td>
        </tr>
        <tr>
          <td><el-input v-model="form2.serial_27" disabled /></td>
          <td>
            <el-input data-cusValidate="text" v-model="form2.positionName_27" />
          </td>
          <td><el-input v-model="form2.readoutValue_27_1" /></td>
          <td><el-input v-model="form2.readoutValue_27_2" /></td>
          <td><el-input v-model="form2.readoutValue_27_3" /></td>
          <td>
            <el-radio-group v-model="form2.readoutValueUnit_27" class="split-radio">
              <el-radio :label="1">nSv/h</el-radio>
              <el-radio :label="2">μSv/h</el-radio>
              <el-radio :label="3">mSv/h</el-radio>
            </el-radio-group>
          </td>
          <td class="result">
            <el-input v-model="form2.correctedAverage_27" disabled />
          </td>
          <td class="result">
            <el-input v-model="form2.correctedValue_27" disabled />
          </td>
          <td class="result" v-if="basicForm.qualityControlCodes && basicForm.qualityControlCodes.includes('06')">
            <el-input
              data-cusValidate="text"
              v-model="form2.yearDoseValue_27"
              disabled
            />
          </td>
          <td>
            <el-autocomplete
              data-cusValidate="text"
              v-model="form2.orientation_27"
              :fetch-suggestions="(queryString, cb) => {
                cb([
                  { value: '土层,人员无法到达' },
                  { value: '临空,人员无法到达' },
                  { value: '无建筑,人员无法到达' },
                ])
              }"
              @select="submitTestForm(2)"
              placeholder=""
              :popper-append-to-body="false"
            ></el-autocomplete>
            <!-- <el-input data-cusValidate="text" v-model="form2.orientation_27" /> -->
          </td>
        </tr>
        <tr v-for="(item, index) in form2.detectionLocations" :key="index">
          <td><el-input v-model="item.serial" disabled /></td>
          <td>
            <el-input data-cusValidate="text" v-model="item.positionName" />
          </td>
          <td><el-input v-model="item.readoutValue_1" /></td>
          <td><el-input v-model="item.readoutValue_2" /></td>
          <td><el-input v-model="item.readoutValue_3" /></td>
          <td>
            <el-radio-group v-model="item.readoutValueUnit" class="split-radio">
              <el-radio :label="1">nSv/h</el-radio>
              <el-radio :label="2">μSv/h</el-radio>
              <el-radio :label="3">mSv/h</el-radio>
            </el-radio-group>
          </td>
          <td class="result">
            <el-input v-model="item.correctedAverage" disabled />
          </td>
          <td class="result">
            <el-input v-model="item.correctedValue" disabled />
          </td>
          <td class="result" v-if="basicForm.qualityControlCodes && basicForm.qualityControlCodes.includes('06')">
            <el-input
              data-cusValidate="text"
              v-model="item.yearDoseValue"
              disabled
            />
          </td>
          <td>
            <el-autocomplete
              data-cusValidate="text"
              v-model="item.orientation"
              :fetch-suggestions="(queryString, cb) => {
                cb([
                  { value: '土层,人员无法到达' },
                  { value: '临空,人员无法到达' },
                  { value: '无建筑,人员无法到达' },
                ])
              }"
              @select="submitTestForm(2)"
              placeholder=""
              :popper-append-to-body="false"
            ></el-autocomplete>
            <!-- <el-input data-cusValidate="text" v-model="item.orientation" /> -->
          </td>
        </tr>
        <tr>
          <td colspan="10">
            <span
              style="
                display: inline-block;
                width: 50px;
                padding: 2px 0;
                border: 1px solid #ccc;
                color: #888;
                border-radius: 2px;
                cursor: pointer;
                position: relative;
                z-index: 999;
              "
              @click="handleClickDetectionLocation('delete')"
              >-</span
            >
            <span
              style="
                display: inline-block;
                width: 50px;
                padding: 2px 0;
                border: 1px solid #ccc;
                margin-left: 10px;
                color: #888;
                border-radius: 2px;
                cursor: pointer;
                position: relative;
                z-index: 999;
              "
              @click="handleClickDetectionLocation('add')"
              >+</span
            >
          </td>
        </tr>
        <tr>
          <td colspan="10" style="text-align: left">
            备注:<el-input
              v-model="form2.remark"
              class="input-line"
              data-cusValidate="text"
              style="width: calc(100% - 50px) !important"
            />
          </td>
        </tr>
        <tr>
          <td colspan="10" style="text-align: left">
            附注:<br />
            1.检测点距机房墙体或防护门等关注点的距离为30cm，顶棚上方检测点距顶棚地面为100cm，机房地面下方检测点距楼下地面为170cm；<br />
            2.若选择扣除本底处理方式，则修正值均扣除本底平均值；当读出值小于本底测量范围最大值的2倍时，修正值报告为“本底水平”；<br />
            <template v-if="basicForm.qualityControlCodes && basicForm.qualityControlCodes.includes('06')">
              3.摄影机的测量结果修正值D已将曝光管电流归一至100 mA；<br />
              4.摄影机年曝光次数W:<el-input
                v-model="form2.yearExposureCount"
                class="input-line"
              />、 常用曝光时间:<el-input
                v-model="form2.exposureTime"
                class="input-line"
              />s、 常用mA:<el-input
                v-model="form2.tubeCurrent"
                class="input-line"
              />， 常用电流修正为Q<el-input
                v-model="form2.correctedTubeCurrent"
                class="input-line"
              />， 估算年常用曝光时间t<el-input
                v-model="form2.estimateExposureTime"
                class="input-line result"
                disabled
              />h。<br />
              <span style="margin-left: 10px"
                ><i>$H=(D-B)·W·Q·t·$</i>（扣除本底修正计算公式）</span
              >
              <span style="margin-left: 20px"
                ><i>$H=D·W·Q·t·$</i>（不扣除本底修正计算公式）</span
              >
            </template>
          </td>
        </tr>
      </table>
    </div>

    <div id="table-3">
      <div class="innertitle">4.工作场所放射防护检测位置示意图：</div>

      <!-- <div class="tip-30">
        1.电离辐射标志：
        <el-radio v-model="form3.radiationMarker" :label="1">有，规范</el-radio>
        <el-radio v-model="form3.radiationMarker" :label="2"
          >无，不规范</el-radio
        ><br />
        2.工作状态指示灯：
        <el-radio v-model="form3.statusLight" :label="1">有，规范</el-radio>
        <el-radio v-model="form3.statusLight" :label="2">有，不规范</el-radio>
        <el-radio v-model="form3.statusLight" :label="3">无，不规范</el-radio
        ><br />
        3.通风状态：
        <el-radio v-model="form3.ventilationCondition" :label="1"
          >动力排风</el-radio
        >
        <el-radio v-model="form3.ventilationCondition" :label="2"
          >空调换气</el-radio
        >
        <el-radio v-model="form3.ventilationCondition" :label="3">无</el-radio>
        <br />
        机房长边长度（m）：
        <el-input v-model="form3.longSideLength" class="input-line"></el-input
        >， 短边长度（m）：
        <el-input v-model="form3.shortSideLength" class="input-line"></el-input
        >， 机房面积（m²）：
        <el-input v-model="form3.area" class="input-line result" disabled></el-input>
      </div> -->

      <!-- <table
        border="1"
        cellspacing="0"
        cellpadding="0"
        align="center"
        style="width: 100%;margin-top: 6px;"
      >
        <tr>
          <td colspan="2" style="text-align: left" width="52%">
            机房顶上建筑名称:
            <el-input
              v-model="form3.topName"
              data-cusValidate="text"
              class="input-line"
              style="width: 300px !important"
            ></el-input>
          </td>
          <td colspan="2" style="text-align: left">
            东墙外:
            <el-input
              v-model="form3.easternWall"
              data-cusValidate="text"
              class="input-line"
              style="width: 300px !important"
            ></el-input>
          </td>
        </tr>
        <tr>
          <td colspan="2" style="text-align: left">
            机房楼下建筑名称:
            <el-input
              v-model="form3.downstairName"
              data-cusValidate="text"
              class="input-line"
              style="width: 300px !important"
            ></el-input>
          </td>
          <td colspan="2" style="text-align: left">
            西墙外:
            <el-input
              v-model="form3.westernWall"
              data-cusValidate="text"
              class="input-line"
              style="width: 300px !important"
            ></el-input>
          </td>
        </tr>
        <tr>
          <td colspan="2" style="text-align: left">
            机房周围建筑:
            <el-input
              v-model="form3.surroundingBuildings"
              class="input-line"
              style="width: 300px !important"
            ></el-input>
          </td>
          <td colspan="2" style="text-align: left">
            北墙外:
            <el-input
              v-model="form3.northWall"
              data-cusValidate="text"
              class="input-line"
              style="width: 300px !important"
            ></el-input>
          </td>
        </tr>
        <tr>
          <td colspan="2" style="text-align: left">
            机房使用面积（m²）:
            <el-input
              v-model="form3.usableArea"
              class="input-line result"
              style="width: 300px !important"
              disabled
            ></el-input>
          </td>
          <td colspan="2" style="text-align: left">
            南墙外:
            <el-input
              v-model="form3.southWall"
              data-cusValidate="text"
              class="input-line"
              style="width: 300px !important"
            ></el-input>
          </td>
        </tr>
        <tr>
          <td style="text-align: left">
            长边长度（m）:
            <el-input
              v-model="form3.longSideLength"
              class="input-line"
            ></el-input>
          </td>
          <td style="text-align: left">
            最小单边长度（m）:
            <el-input
              v-model="form3.minimumLength"
              class="input-line"
            ></el-input>
          </td>
          <td colspan="2" rowspan="2" style="text-align: left">
            铅橡胶围裙（<el-input
              v-model="form3.apron"
              class="input-line"
            ></el-input
            >）件; 铅橡胶帽子（<el-input
              v-model="form3.hat"
              class="input-line"
            ></el-input
            >）件; 铅橡胶颈套（<el-input
              v-model="form3.neckBrace"
              class="input-line"
            ></el-input
            >）件;
            <br />
            铅橡胶手套（<el-input
              v-model="form3.gloves"
              class="input-line"
            ></el-input
            >）副; 铅防护眼镜（<el-input
              v-model="form3.glasses"
              class="input-line"
            ></el-input
            >）件; 铅防护屏风（<el-input
              v-model="form3.screen"
              class="input-line"
            ></el-input
            >）件;
            <br />
            其他防护用品（<el-input
              v-model="form3.otherProtection"
              class="input-line"
            ></el-input
            >）
            <br />
            主要包括:
            <el-input
              v-model="form3.otherInclude"
              data-cusValidate="text"
              style="width: 300px; text-align: left"
            ></el-input>
          </td>
        </tr>
        <tr>
          <td style="text-align: left">
            电离辐射警告标志:
            <el-radio-group
              v-model="form3.radiationWarning"
              class="split-radio"
            >
              <el-radio :label="1">有,规范</el-radio>
              <el-radio :label="2">无,不规范</el-radio>
            </el-radio-group>
          </td>
          <td style="text-align: left">
            工作状态指示灯:
            <el-radio-group v-model="form3.pilotLamp" class="split-radio">
              <el-radio :label="1">有,规范</el-radio>
              <el-radio :label="2">无,不规范</el-radio>
            </el-radio-group>
          </td>
        </tr>
        <tr>
          <td style="text-align: left">
            动力通风装置:
            <el-radio-group v-model="form3.ventilate" class="split-radio">
              <el-radio :label="1">动力通风</el-radio>
              <el-radio :label="2">空调换风</el-radio>
              <el-radio :label="3">无</el-radio>
            </el-radio-group>
          </td>
          <td style="text-align: left">
            指示灯联动装置:
            <el-radio-group
              v-model="form3.linkagePilotLamp"
              class="split-radio"
            >
              <el-radio :label="true">有</el-radio>
              <el-radio :label="false">无</el-radio>
            </el-radio-group>
          </td>
          <td colspan="2" style="text-align: left">
            防护设备配备情况:辐射巡测仪（<el-input
              v-model="form3.radiationScanner"
              class="input-line"
            ></el-input
            >）台
          </td>
        </tr>
        <tr>
          <td colspan="2" style="text-align: left">
            自动闭门装置或曝光时关闭机房门的管理：
            <el-radio-group
              v-model="form3.automaticDoorClosing"
              class="split-radio"
            >
              <el-radio :label="true">正常</el-radio>
              <el-radio :label="false">异常</el-radio>
            </el-radio-group>
          </td>
          <td colspan="2" style="text-align: left">
            稳定性检测情况：
            <el-radio-group v-model="form3.stability" class="split-radio">
              <el-radio :label="1">开展</el-radio>
              <el-radio :label="2">未开展</el-radio>
            </el-radio-group>
          </td>
        </tr>
        <tr>
          <td colspan="2" style="text-align: left">
            候诊区放射防护注意事项告知栏:
            <el-radio-group v-model="form3.noticeField" class="split-radio">
              <el-radio :label="true">有</el-radio>
              <el-radio :label="false">无</el-radio>
            </el-radio-group>
          </td>
          <td colspan="2" style="text-align: left">
            机房防护门:
            <el-checkbox-group
              style="display: inline-block"
              v-model="form3.protectiveDoor"
            >
              <el-checkbox label="1">手动平开机房门</el-checkbox>
              <el-checkbox label="2">推拉式机房门</el-checkbox>
              <el-checkbox label="3">电动平开防护门</el-checkbox>
            </el-checkbox-group>
          </td>
        </tr>
        <tr>
          <td colspan="2" style="text-align: left">
            电动推拉门防夹装:
            <el-radio-group v-model="form3.antiPinchDevice" class="split-radio">
              <el-radio :label="true">有</el-radio>
              <el-radio :label="false">无</el-radio>
            </el-radio-group>
          </td>
          <td colspan="2" style="text-align: left">
            控制室防护门:
            <el-checkbox-group
              style="display: inline-block"
              v-model="form3.controlProtectiveDoor"
              class="split-radio"
            >
              <el-checkbox label="1">平开机房门</el-checkbox>
              <el-checkbox label="2">推拉式机房门</el-checkbox>
            </el-checkbox-group>
          </td>
        </tr>
      </table> -->
    </div>

    <el-dialog
      :title="operType == 'add' ? '选择添加的点位类型' : '选择删除的点位类型'"
      :visible.sync="dialogVisible"
      width="500px"
      append-to-body
      v-dialogDrag="true"
      @open="handleDialogOpen"
      @close="handleDialogClosed"
    >
      <div style="display: flex; align-items: center">
        <span style="width: 100px; white-space: nowrap">检测位置类型：</span>
        <el-select
          style="width: 100px"
          v-model="detectionLocationType"
          placeholder="请选择"
          @change="handleDetectionLocationTypeChange"
        >
          <el-option
            v-for="item in pointTypeList"
            :key="item.value"
            :label="item.label"
            :value="item.value"
          ></el-option>
        </el-select>
        <el-select
          style="width: 250px"
          v-model="groupNumber"
          placeholder="请选择"
          v-if="operType == 'delete'"
        >
          <template v-for="(item, index) in groupNumberList">
            <el-option
              :key="index"
              :label="item.label"
              :value="item.value"
              v-if="containsGroup && containsGroup.includes(item.value)"
            ></el-option>
          </template>

          <!-- <el-option label="②" :value="2" v-if="containsGroup.includes(2)"></el-option>
            <el-option label="③" :value="3" v-if="containsGroup.includes(3)"></el-option>
            <el-option label="④" :value="4" v-if="containsGroup.includes(4)"></el-option>
            <el-option label="⑤" :value="5" v-if="containsGroup.includes(5)"></el-option>
            <el-option label="⑥" :value="6" v-if="containsGroup.includes(6)"></el-option>
            <el-option label="⑦" :value="7" v-if="containsGroup.includes(7)"></el-option>
            <el-option label="⑧" :value="8" v-if="containsGroup.includes(8)"></el-option>
            <el-option label="⑨" :value="9" v-if="containsGroup.includes(9)"></el-option> -->
        </el-select>
      </div>
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="handleOperDetectionLocationRow"
          >确 定</el-button
        >
      </div>
    </el-dialog>

    <div id="table-4">
      <div class="innertitle" style="margin: 12px 0">
        <el-button
          style="float: right"
          icon="el-icon-refresh"
          size="mini"
          @click="handleOpenDragCanvas()"
          >设计平面图</el-button
        >
      </div>
      <div class="imageUpload">
        <div>
          <imageUpload
            :limit="1"
            :isShowTip="false"
            v-model="form.recordOssId"
            @input="handleChangeImage"
          />
          <div style="text-align: center;">原始记录点位图</div>
        </div>
        <div style="margin-left: 50px">
          <imageUpload
            :limit="1"
            :isShowTip="false"
            v-model="form.ossId"
            @input="handleChangeImage"
          />
          <div style="text-align: center;">报告点位图</div>
        </div>
      </div>

      <!-- <div class="tip-30">
          有关说明:<br/>
          1、本底校准值=本底读出值x校准因子;<br/>
          2、未扣除本底值情况下:检测结果=读出值平均值x校准因子，扣除本底值情况下: 检测结果=(读出值平均值-本底读出值)x校准因子x相应时间修正系数:<br/>
          3、X射线设备机房的防护检测应在巡测的基础上，对关注点的局部屏蔽和缝隙进行重点检测。关注点应包括:四面墙体、地板、顶棚、机房门、操作门、观察窗、采光窗\窗体、传片箱、管线口、工作人员操作位等。
        </div> -->
    </div>

    <div id="table9">
      <div class="innertitle">其他说明：</div>
      <div class="tip-30">
        <el-input
          type="textarea"
          placeholder=""
          v-model="basicForm.protectionDetectionVo.specialCircumstances"
          :autosize="{ minRows: 2 }"
          @blur="
            $bus.$emit(
              'update-protection-basicinfo',
              basicForm.protectionDetectionVo.taskDetectionEquipmentResultId
            )
          "
        ></el-input>
      </div>
    </div>

    <DragCanvas ref="dragCanvasRefs" @confirm="handleConfirmDrag" />
  </div>
</template>

<script>
import {
  getInfoById23,
  background,
  protection,
  doseRateControlLevel,
  defensePosition,
  saveInfo,
  getPointType,
  getDetectionLocationRow,
} from "@/api/testItem/item23";
import { listByIds } from "@/api/system/oss";
import DragCanvas from "../dragCanvas.vue";

export default {
  name: "testItem23",
  dicts: ["protection_condition"],
  components: { DragCanvas },
  data() {
    return {
      protectionShow: false,
      readoutList: [
        {
          id: 1,
          label: "mSv/h",
          value: 1,
        },
        {
          id: 2,
          label: "μSv/h",
          value: 2,
        },
      ],
      otherTypeLists: [
        {
          id: 1,
          label: "普通模式",
          value: 1,
        },
        {
          id: 2,
          label: "DBT",
          value: 2,
        },
      ],
      // tab切换通用数据
      form: {},
      // 表单-1.本底值检测
      form1: {},
      // 表单-2、周围作场所辐射防护测
      form2: {},
      form3: {
        protectiveDoor: [],
        controlProtectiveDoor: [],
      },
      form4: {},
      fileList: [],
      showImageUpload: false,
      itemsId: null,
      operType: "add",
      dialogVisible: false,
      pointTypeList: [],
      groupNumberList: [
        { label: "①", value: 1, text: "①" },
        { label: "②", value: 2, text: "②" },
        { label: "③", value: 3, text: "③" },
        { label: "④", value: 4, text: "④" },
        { label: "⑤", value: 5, text: "⑤" },
        { label: "⑥", value: 6, text: "⑥" },
        { label: "⑦", value: 7, text: "⑦" },
        { label: "⑧", value: 8, text: "⑧" },
        { label: "⑨", value: 9, text: "⑨" },
        { label: "⑩", value: 10, text: "⑩" },
        { label: "⑪", value: 11, text: "⑪" },
        { label: "⑫", value: 12, text: "⑫" },
        { label: "⑬", value: 13, text: "⑬" },
        { label: "⑭", value: 14, text: "⑭" },
        { label: "⑮", value: 15, text: "⑮" },
      ],
      detectionLocationType: 1,
      groupNumber: "",
      containsGroup: [],
    };
  },
  props: {
    // tab栏
    activeNameEquipment: {
      type: String,
      default: "0",
    },
    // 基本信息数据
    basicForm: {
      type: Object,
      default: () => {
        return {};
      },
    },
  },
  watch: {
    activeNameEquipment: {
      handler(val) {
        let _this = this;
        this.$nextTick(() => {
          // 02-直接荧光屏透视设备专用检测项目
          // 获取详情
          getInfoById23(
            this.basicForm.protectionDetectionVo.taskDetectionEquipmentResultId
          )
            .then((response) => {
              let { schematicImage, recordOssId, imageJson } = response.data;
              this.form.imageJson = imageJson || "";
              this.itemsId = response.data?.itemsId;
              // 1.本底值检测
              this.form1 = response.data?.detectionBackgroundValue || {};
              this.form1.backgroundFormula = this.form1.backgroundFormula || 1;
              // 2.周围工作场所辐射防护检测
              this.form2 = response.data?.detectionProtection || {};
              this.form2.detectionLocations = this.form2.detectionLocations || [];
              this.form2.detectionLocations.sort((a, b) => a.positionType - b.positionType || a.groupNumber - b.groupNumber);
              // 3、周剂量限值导出剂量率控制水平
              this.form4 = response.data?.doseRateControlLevel || {};
              this.form4.detectionPlaceList = this.form4.detectionPlaceList || [];
              let differRows = 21 - this.form4.detectionPlaceList
              for (let i = 0; i < differRows; i++) {
                this.form4.detectionPlaceList.push({})
              }
              // 4
              this.form3 = response.data?.defensePosition || {};
              this.form3.protectiveDoor = this.form3.protectiveDoor?.split(",") || [];
              this.form3.controlProtectiveDoor = this.form3.controlProtectiveDoor?.split(",") || [];
              // 3.获取图片
              this.form.ossId = schematicImage;
              this.form.recordOssId = recordOssId;
              this.showImageUpload = true;

              // 绑定请求
              this.bindMethod();
            })
            .then()
            .catch((response) => {
              this.$emit("loadingchange", true);
            });
        });
      },
      deep: true,
      immediate: true,
    },
  },
  methods: {
    submitTestForm(index) {
      console.log("提交检测项", index);
      this.$emit("loadingchange", true); /* 说明绑定成功 */
      if (index === "form") {
        this.form.itemsId = this.itemsId;
      } else {
        this[`form${index}`].itemsId = this.itemsId;
      }
      switch (index) {
        // 1.DAS动态范围。DAS对比灵敏度 伪影
        case 1:
          background(this.form1).then((response) => {
            response.data ? (this.form1 = response.data) : "";
            this.$emit("loadingchange", false);
            this.submitTestForm(2);
          });
          break;
        case 2:
          protection(this.form2).then((response) => {
            response.data ? (this.form2 = response.data) : "";
            this.$emit("loadingchange", false);
          });
          break;
        case 4:
          doseRateControlLevel(this.form4).then((response) => {
            response.data ? (this.form4 = response.data) : "";
            this.$emit("loadingchange", false);
          });
          break;
        case 3:
          const data = JSON.parse(JSON.stringify(this.form3));
          data.protectiveDoor = data.protectiveDoor.join(",");
          data.controlProtectiveDoor = data.controlProtectiveDoor.join(",");
          defensePosition(data).then((response) => {
            response.data ? (this.form3 = response.data) : "";
            this.form3.protectiveDoor =
              this.form3.protectiveDoor?.split(",") || [];
            this.form3.controlProtectiveDoor =
              this.form3.controlProtectiveDoor?.split(",") || [];
            this.$emit("loadingchange", false);
          });
          break;
        case "form":
          // 其余信息
          let { ossId, recordOssId, itemsId, imageJson } = this.form;
          saveInfo({ ossId, recordOssId, itemsId, imageJson }).then(
            (response) => {
              this.$emit("loadingchange", false);
            }
          );
          break;
      }
    },
    // 绑定方法
    bindMethod() {
      let itemsLength = 4;
      for (let index = 0; index < itemsLength; index++) {
        let tableInputs = document
          .getElementById(`table-${index + 1}`)
          .getElementsByTagName("input");
        this.$nextTick(() => {
          Array.from(tableInputs).forEach((element) => {
            this.bind(element, () => {
              this.submitTestForm(index + 1);
            });
          });
        });
      }
    },
    handleClickDetectionLocation(type) {
      this.operType = type;
      this.dialogVisible = true;
      if (this.pointTypeList.length <= 0) {
        getPointType()
          .then((res) => {
            this.pointTypeList = res.data || [];
          })
          .catch(() => {});
      }
    },
    handleOperDetectionLocationRow() {
      if (this.operType == "add") {
        if (!this.detectionLocationType) {
          this.$message.error("请选择检测位置类型");
          return;
        }
        getDetectionLocationRow(this.itemsId, this.detectionLocationType)
          .then((res) => {
            this.form2.detectionLocations.push(...(res.data || []));
            this.form2.detectionLocations.sort(
              (a, b) =>
                a.positionType - b.positionType || a.groupNumber - b.groupNumber
            );
            this.dialogVisible = false;
            this.submitTestForm(2);
            this.bindMethod();
          })
          .catch(() => {});
      } else if (this.operType == "delete") {
        if (!this.detectionLocationType) {
          this.$message.error("请选择检测位置类型");
          return;
        }
        if (!this.groupNumber) {
          this.$message.error("请选择检测位置组");
          return;
        }
        this.form2.detectionLocations = this.form2.detectionLocations.filter(
          (item) =>
            item.groupNumber != this.groupNumber ||
            item.positionType != this.detectionLocationType
        );
        console.log(this.form2.detectionLocations);
        this.dialogVisible = false;
        this.submitTestForm(2);
        this.bindMethod();
      }
    },
    handleDetectionLocationTypeChange() {
      if (this.operType == "delete") {
        this.containsGroup = [];
        this.groupNumberList.forEach((it) => (it.label = it.text));
        this.form2.detectionLocations.forEach((item) => {
          if (item.positionType == this.detectionLocationType) {
            this.containsGroup.push(item.groupNumber);
            if (
              this.detectionLocationType == 4 ||
              this.detectionLocationType == 5
            ) {
              // 墙、点位
              const findRes = this.groupNumberList.find(
                (it) => it.value == item.groupNumber
              );
              if (findRes) findRes.label = item.positionName;
            }
          }
        });
        this.containsGroup = Array.from(new Set(this.containsGroup));
      }
    },
    handleDialogOpen() {
      this.handleDetectionLocationTypeChange();
    },
    handleDialogClosed() {
      this.detectionLocationType = 1;
      this.groupNumber = "";
    },
    handleOpenDragCanvas() {
      this.$refs.dragCanvasRefs.openDialog({
        imageJson: this.form.imageJson,
      });
    },
    handleConfirmDrag(data) {
      this.form = {
        ...this.form,
        ossId: data.ossId,
        imageJson: data.imageJson,
      };
      this.submitTestForm("form");
    },
    handleChangeImage(val) {
      this.submitTestForm("form");
    },
    isAllNull(rowNum) {
      if (rowNum == 24) {
        if (
          !this.form2.positionName_24 &&
          this.form2.positionName_24 !== 0 &&
          !this.form2.readoutValue_24_1 &&
          this.form2.readoutValue_24_1 !== 0 &&
          !this.form2.readoutValue_24_2 &&
          this.form2.readoutValue_24_2 !== 0 &&
          !this.form2.readoutValue_24_3 &&
          this.form2.readoutValue_24_3 !== 0 &&
          !this.form2.correctedAverage_24 &&
          this.form2.correctedAverage_24 !== 0 &&
          !this.form2.correctedValue_24 &&
          this.form2.correctedValue_24 !== 0 &&
          !this.form2.yearDoseValue_24 &&
          this.form2.yearDoseValue_24 !== 0
        ) {
          return true;
        }
      }
      if (rowNum == 25) {
        if (
          !this.form2.positionName_25 &&
          this.form2.positionName_25 !== 0 &&
          !this.form2.readoutValue_25_1 &&
          this.form2.readoutValue_25_1 !== 0 &&
          !this.form2.readoutValue_25_2 &&
          this.form2.readoutValue_25_2 !== 0 &&
          !this.form2.readoutValue_25_3 &&
          this.form2.readoutValue_25_3 !== 0 &&
          !this.form2.correctedAverage_25 &&
          this.form2.correctedAverage_25 !== 0 &&
          !this.form2.correctedValue_25 &&
          this.form2.correctedValue_25 !== 0 &&
          !this.form2.yearDoseValue_25 &&
          this.form2.yearDoseValue_25 !== 0
        ) {
          return true;
        }
      }
      if (rowNum == 26) {
        if (
          !this.form2.positionName_26 &&
          this.form2.positionName_26 !== 0 &&
          !this.form2.readoutValue_26_1 &&
          this.form2.readoutValue_26_1 !== 0 &&
          !this.form2.readoutValue_26_2 &&
          this.form2.readoutValue_26_2 !== 0 &&
          !this.form2.readoutValue_26_3 &&
          this.form2.readoutValue_26_3 !== 0 &&
          !this.form2.correctedAverage_26 &&
          this.form2.correctedAverage_26 !== 0 &&
          !this.form2.correctedValue_26 &&
          this.form2.correctedValue_26 !== 0 &&
          !this.form2.yearDoseValue_26 &&
          this.form2.yearDoseValue_26 !== 0
        ) {
          return true;
        }
      }
      if (rowNum == 27) {
        if (
          !this.form2.positionName_27 &&
          this.form2.positionName_27 !== 0 &&
          !this.form2.readoutValue_27_1 &&
          this.form2.readoutValue_27_1 !== 0 &&
          !this.form2.readoutValue_27_2 &&
          this.form2.readoutValue_27_2 !== 0 &&
          !this.form2.readoutValue_27_3 &&
          this.form2.readoutValue_27_3 !== 0 &&
          !this.form2.correctedAverage_27 &&
          this.form2.correctedAverage_27 !== 0 &&
          !this.form2.correctedValue_27 &&
          this.form2.correctedValue_27 !== 0 &&
          !this.form2.yearDoseValue_27 &&
          this.form2.yearDoseValue_27 !== 0
        ) {
          return true;
        }
      }
    },
  },
};
</script>

<style lang="scss" scoped>
@import "../content.scss";
.protection-table {
  ::v-deep .el-input {
    width: 100%;
  }
}

::v-deep .dir-select.el-select > .el-input {
  height: 36px;
}
</style>
